package com.demo.threadpool;

import java.util.concurrent.*;

public class ExecutorServiceMain {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newSingleThreadExecutor();

        Future<?> future = executorService.submit(() -> {
            System.out.println("enter thread ...");
            Thread.sleep(10000);
            return 1;
        });

        System.out.println("begin get()");
        System.out.println(future.get());
        System.out.println("end get()");
    }
}
